package com.bjsasc.open.mqtt.result;

/** 
 * @ClassName: ResultGenerator 
 * @Description: 响应结果生成工具 
 * @author zhangbingbing 
 * @date 2024年3月25日 下午2:12:05 
 * @version 1.0 
 */
public class ResultGenerator {
    private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";

    // 只返回状态
    public static JsonResult getSuccessResult() {
        return new JsonResult()
                .setCode(ResultCode.SUCCESS)
                .setMessage(DEFAULT_SUCCESS_MESSAGE);
    }

    // 成功返回数据
    public static JsonResult getSuccessResult(Object data) {
        return new JsonResult()
                .setCode(ResultCode.SUCCESS)
                .setMessage(DEFAULT_SUCCESS_MESSAGE)
                .setData(data);
    }

    // 失败
    public static JsonResult getFailResult(String message) {
        return new JsonResult()
                .setCode(ResultCode.FAIL)
                .setMessage(message);
    }
	
	
}
